﻿<Controls:MetroWindow x:Class="RadioPlayer.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
                xmlns:local="clr-namespace:MahApps.Metro.Behaviours;assembly=MahApps.Metro" 
        xmlns:Controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
                      xmlns:RadioPlayer="clr-namespace:RadioPlayer"  Height="148" Width="142" Loaded="WindowLoaded" WindowStyle="ToolWindow" 
        ResizeMode="NoResize" MaxHeight="180" MaxWidth="155" MinHeight="180" MinWidth="155" Closing="MetroWindow_Closing" DataContext="Player">
    <i:Interaction.Behaviors>
        <local:BorderlessWindowBehavior ResizeWithGrip="False"/>
    </i:Interaction.Behaviors>
    <Window.CommandBindings>
        <CommandBinding Command="RadioPlayer:MainWindow.PlayStopCommand" CanExecute="PlayStopCommandBindingCanExecute" Executed="PlayStopCommandBindingExecuted" />
        <CommandBinding Command="RadioPlayer:MainWindow.MuteUnmuteCommand" CanExecute="MuteUnmuteCommandBindingCanExecute" Executed="MuteUnmuteCommandBindingExecuted" />
    </Window.CommandBindings>
    <Window.Resources>
        <ResourceDictionary x:Key="MainDict">
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Colours.xaml" />
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml"/>
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml"/>
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.AnimatedSingleRowTabControl.xaml" />
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Icons/MergedResources.xaml" />
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/Blue.xaml" />
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseLight.xaml" />
                <ResourceDictionary Source="CustomDictionary.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>

        
    </Window.Resources>
    <Controls:MetroContentControl>
        
        <Grid x:Name="LayoutRoot" Width="130"  Height="Auto" DataContext="Player">
        <Grid.RowDefinitions>
            <RowDefinition Height="26"/>
            <RowDefinition Height="45"/>
            <RowDefinition Height="12" />
            <RowDefinition Height="43" />
                <RowDefinition Height="15*" />
            </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition MinWidth="30" Width="30*" />
            <ColumnDefinition MinWidth="30" Width="30*"/>
        </Grid.ColumnDefinitions>
        <TextBlock Text="mRadio" FontSize="18"></TextBlock>
            <Button  Style="{StaticResource ResourceKey=ButtonStyle}" ToolTip="Play/Stop" Grid.Row="3" Width="Auto" Height="30" Command="RadioPlayer:MainWindow.PlayStopCommand"
                 x:Name="Playbutton" Background="{x:Null}" >
            <Button.BorderBrush>
                <SolidColorBrush x:Name="_border" />
            </Button.BorderBrush>
            <Image Name="PlayButtonImage" />
            <Button.Triggers>
                <EventTrigger RoutedEvent="Button.MouseEnter">
                    <BeginStoryboard Storyboard="{StaticResource buttonAnim}"/>
                </EventTrigger>
            </Button.Triggers>
        </Button>

        <Button  ToolTip="Mute/Unmute"  Style="{StaticResource ResourceKey=ButtonStyle}" Height="30" Width="Auto" Grid.Column="1" Grid.Row="3" x:Name="MuteButton" Command="RadioPlayer:MainWindow.MuteUnmuteCommand" Background="{x:Null}" BorderBrush="{x:Null}" BorderThickness="0" >
            <Image Name="MuteButtonImage" Source="{Binding}" />
        </Button>
        
        <Label Content="offline." Grid.Row="1" Grid.ColumnSpan="2" Height="28" Width="Auto" Name="lblstatus" VerticalAlignment="Top" Margin="0,33,0,0" Grid.RowSpan="3" />
        
            <StackPanel Orientation="Horizontal" Grid.ColumnSpan="2" Grid.Row="1" Margin="0,10,0,3" >
                <Button ToolTip="Add Station" Content="+"  Width="20" Click="Button_Click" Padding="0" VerticalAlignment="Top" />
                <ComboBox Height="26"   Name="StationComboBox" VerticalAlignment="Top" Width="90" SelectionChanged="StationComboBoxSelectionChanged">

            <ComboBox.ItemTemplate>
                <DataTemplate>
                <TextBlock Text="{Binding Path=StreamName}" />
                </DataTemplate>
            </ComboBox.ItemTemplate>
                
               
            
        </ComboBox>
                <Button HorizontalAlignment="Right" ToolTip="Remove Station" Content="-"  Width="20" Padding="0" Click="Button_Click_1" VerticalAlignment="Top" VerticalContentAlignment="Center" />

            </StackPanel>
            
            <StackPanel Orientation="Vertical" Grid.Row="4" Grid.ColumnSpan="2" >
                <Label Content="Volume:" Margin="0" Padding="0"/>
            <Slider Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="2" x:Name="VolumeSlider" Value="{Binding Path=settings.volume, Mode=TwoWay}" Minimum="0" Maximum="100" IsSnapToTickEnabled="True" TickFrequency="1"/>
            
            
            </StackPanel>
            
        </Grid>
    </Controls:MetroContentControl>
    
   <Controls:MetroWindow.TaskbarItemInfo>
        <TaskbarItemInfo Description="Media Controls" ThumbnailClipMargin="5" Overlay="{Binding Path=StatusImage}">
          
            <TaskbarItemInfo.ThumbButtonInfos>
                
                <ThumbButtonInfoCollection>
                    <ThumbButtonInfo x:Name="ThumbPlayStop" Command="RadioPlayer:MainWindow.PlayStopCommand" ImageSource="{Binding Path=SetPlayButtonImage, Converter={StaticResource ResourceKey=IsPlayingToImage}}" IsEnabled="True" IsBackgroundVisible="true" Description="Play/Stop" Visibility="Visible" DismissWhenClicked="False" CommandTarget="{Binding ElementName=Playbutton}"/>
                    <ThumbButtonInfo x:Name="ThumbMuteUnmute" Command="RadioPlayer:MainWindow.MuteUnmuteCommand" ImageSource="{Binding Path=SetMuteButtonImage, Converter={StaticResource ResourceKey=IsPlayingToImage}}" IsEnabled="True" IsBackgroundVisible="true" Description="Mute/Unmute" Visibility="Visible" DismissWhenClicked="False" CommandTarget="{Binding ElementName=MuteButton}"/>
                </ThumbButtonInfoCollection>
            </TaskbarItemInfo.ThumbButtonInfos>
        </TaskbarItemInfo>
    </Controls:MetroWindow.TaskbarItemInfo>
    
</Controls:MetroWindow>
